
//
//  DYMemberCardListCell.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/21.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYMemberCardListCell.h"

@interface DYMemberCardListCell ()

@property (nonatomic,strong)UIView *blackView;
@property (nonatomic,strong)UIImageView *bgView;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UILabel *cardLabel;
@property (nonatomic,strong)UILabel *cardTimeLabel;
@property (nonatomic,strong)UILabel *cardNumberLabel;
@property (nonatomic,strong)UILabel *priceLabel;

@end

@implementation DYMemberCardListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)dy_initUI
{
    [super dy_initUI];
    
    self.hideSeparatorLabel=YES;
    [self xhq_noneSelectionStyle];
    
    self.blackView =({
        UIView *view=[[UIView alloc]init];
        view.backgroundColor=[UIColor colorWithWhite:0 alpha:0.2];
        [view xhq_cornerRadius:5];
        view;
    });
    
    self.bgView =({
        UIImageView *imageView=[Utils imageView];
        [imageView xhq_cornerRadius:5];
        imageView.contentMode=UIViewContentModeScaleToFill;
        imageView;
    });
    
    self.nameLabel=({
       UILabel *label=[Utils labelWithTitleBlodFontSize:17 textColor:WhiteColor alignment:0];
        label;
    });
    
    self.cardLabel=({
        UILabel *label=[Utils labelWithTitleFontSize:15 textColor:WhiteColor alignment:0];
        label;
    });
    
    self.cardTimeLabel =({
        UILabel *label=[Utils labelWithTitleFontSize:15 textColor:WhiteColor alignment:0];
        label;
    });
    
    self.cardNumberLabel=({
        UILabel *label=[Utils labelWithTitleFontSize:15 textColor:WhiteColor alignment:0];
        label;
    });
    
    self.priceLabel = ({
        UILabel *label=[Utils labelWithTitleFontSize:14 textColor:[UIColor xhq_aTitle] alignment:1];
        [label xhq_cornerRadius:BILIHEIGHT(16)];
        label.backgroundColor=WhiteColor;
        label;
    });
    
    [self addSubview:self.bgView];
    [self addSubview:self.blackView];
    [self addSubview:self.nameLabel];
    [self addSubview:self.cardLabel];
    [self addSubview:self.cardNumberLabel];
    [self addSubview:self.priceLabel];
    [self addSubview:self.cardTimeLabel];
    
    [self.bgView makeConstraints:^(MASConstraintMaker *make) {
        make.size.equalTo(CGSizeMake(BILIWIDTH(355), BILIHEIGHT(200)));
        make.centerX.equalTo(self);
        make.top.equalTo(BILIHEIGHT(10));
    }];
    
    [self.blackView makeConstraints:^(MASConstraintMaker *make) {
        make.size.equalTo(CGSizeMake(BILIWIDTH(355), BILIHEIGHT(200)));
        make.centerX.equalTo(self);
        make.top.equalTo(BILIHEIGHT(10));
    }];
    
    [self.nameLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.bgView).offset(BILIWIDTH(20));
        make.top.equalTo(self.bgView).offset(BILIHEIGHT(20));
    }];
    
    [self.cardLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel);
        make.top.equalTo(self.nameLabel.bottom).offset(BILIHEIGHT(10));
    }];
    
    [self.cardTimeLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel);
         make.bottom.equalTo(self.cardNumberLabel.top).offset(BILIHEIGHT(-13));
    }];
    
    [self.cardNumberLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel);
        make.bottom.equalTo(self.bgView).offset(BILIHEIGHT(-20));
    }];
    
    [self.priceLabel makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.cardNumberLabel);
        make.right.equalTo(BILIWIDTH(-18));
        make.height.equalTo(BILIHEIGHT(32));
    }];
    
    self.nameLabel.text=@"家乐福";
    self.cardLabel.text=@"电子会员卡";
    self.cardNumberLabel.text=@"卡号：NO.1423423423";
    self.cardTimeLabel.text=@"开卡时间：2018-09-08 12:33:45";
    self.priceLabel.text=@"¥300.00";
    
    CGSize size=[self.priceLabel.text sizeWithAttributes:@{NSFontAttributeName:self.priceLabel.font}];
    
    [self.priceLabel updateConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(size.width+BILIWIDTH(30));
    }];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
